<extend name="Base/mob_common"/>
<block name="mob_body">
    <script src="__JS__/weibo.js"></script>
    <link rel="stylesheet" href="__CSS__/weibo.css"/>
    <div class="addweibo-container ">

        <div class="am-form-group am-cf weibo_post_box" id="comment" style="padding: 10px;margin: auto">
            <input type="hidden" id="img_ids" name="attach_ids" value="">
            <textarea maxlength="200" class="content" type="text" name="content" placeholder="分享新鲜事....."
                      style="width: 100%;height:150px;padding: 5px"></textarea>

            <!--插入图片表情-->
            <!--表情-->
            <a class="am-fl" href="javascript:" data-url=" {:U('Core/Expression/getSmile')}"
               onclick="insertFace($(this))" style="margin-top: 5px">
                <img id="abc" src="__CORE_IMAGE__/bq.png">
            </a>

            <div id="emot_content" class="emot_content"></div>

            <!--表情END-->
            <div class="fileupload-buttonbar">
                <a type="button" class="am-btn am-btn-sm am-fl " style="  line-height: 0.2;"><img
                        src="__IMG__/image.png"></a>

                <div class="fileinput-button" style="width: 100%">
                    <input type="file" name="files" class="btn" id="choose"
                           style="left: 35px;position:absolute;z-index: 1;width: 35px;height:40px;opacity: 0;cursor: pointer;"
                           data-url="{:U('Core/File/uploadPictureBase64')}" multiple/></div>

                <style>
                    .img-list li {
                        float: left;
                        position: relative;
                        display: inline-block;
                        width: 100px;
                        height: 100px;
                        margin: 5px 5px 20px 5px;
                        border: 1px solid rgb(100, 149, 198);
                        background: #fff no-repeat center;
                        background-size: cover;
                        border-radius: 10px;
                    }
                </style>
            </div>
            <!--插入图片表情结束-->
            <!--发布按钮-->
            <p class="submitweibo" url="{:U('Mob/Weibo/doSend')}">
                <button style="float: right" type="submit" class="am-btn am-btn-primary am-btn-block">发布</button>
            </p>
            <!--发布按钮END-->
        </div>
        <ul class="img-list am-fl" style="padding-left:0px;">
            <!--图片显示区域-->
        </ul>
    </div>
    <script>
        add_img();

        $('.submitweibo').click(function () {
            var weibo_content = $(this).parents('#comment').find('.content').val();
            var img_Id = $(this).parents('#comment').find('#img_ids').val();
            var url = $(this).attr('url');

            $.post(url, {content: weibo_content, attach_ids: img_Id}, function (msg) {
                if (msg.status == 1) {
                    toast.success('微博发布成功!');
                    setTimeout(function () {
                        window.location.href = "{:U('Mob/weibo/index')}";
                    }, 1000);
                } else {
                    toast.error(msg.info);
                }
            }, 'json')
        });



    </script>
</block>


